﻿//======================================================================
//
//        Copyright (C) 2015   
//        All rights reserved
//
//        filename : PutInCard
//        description : 半成品/成品卡入库

//        created by XXX at  20150821
//
//======================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CardLogistics.Web.Components;
using System.Data;

namespace CardLogistics.Web.MainPage.PutInCard.PutInCard
{
    public partial class Detail : BasePage
    {
        private static readonly CardLogistics.DAL.PutInCard.PutInCardData DAL = new DAL.PutInCard.PutInCardData();
        private static readonly CardLogistics.DAL.PutInCard.PutInCard_DetailData DetailDAL = new DAL.PutInCard.PutInCard_DetailData();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitControl();
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public void InitControl()
        {
            string _key = Request.QueryString["id"];
            WebUserControl_AppInfo1.InfoID = _key;
            WebUserControl_AppInfo1.UserID = LoggedUser.ID;
            if (!string.IsNullOrEmpty(_key))
            {
                CardLogistics.Model.PutInCard.PutInCard pData = DAL.GetModel(_key);
                SetWebControls(this.Page, pData);
                CardVERSION.Text = pData.VERSION;
                PUTINDATE.Text = Convert.ToDateTime(pData.PUTINDATE).ToShortDateString();//入库日期
                CREATEDATE.Text = Convert.ToDateTime(pData.CREATEDATE).ToShortDateString();//制卡日期

                DataTable dd = DetailDAL.GetInfoByPutInId(pData.ID);
                rptDetailList.DataSource = dd;
                //根据卡号升序排列
                dd.DefaultView.Sort = "CardId ASC";
                rptDetailList.DataBind();
              
            }
        }
    }
}